<?php
define ( 'FOOTPRINT_ROOT', realpath ( dirname ( __FILE__ ) . '/' ) );
define ( 'WP_ROOT', FOOTPRINT_ROOT.'/../../../');
require_once(WP_ROOT.'wp-blog-header.php');

$user = wp_get_current_user();
if ($user==null||$user->ID==''){
	exit();
}
$lat = $_REQUEST['lat'];
$lng = $_REQUEST['lng'];
$place = $_REQUEST['place'];
$cate = $_REQUEST['cate'];
$dt = $_REQUEST['dt'];
$img_url = $_REQUEST['img_url'];
$description = $_REQUEST['description'];

$table_name = $wpdb->prefix . "footprint";
$insert = "INSERT INTO " . $table_name . " (uid, lat, lng, place, cate, dt, img_url, description ) values($user->ID,$lat,$lng,'$place','$cate','$dt','$img_url','$description');";
$wpdb->query ( $insert );
$result->lat = $lat;
$result->lng = $lng;
$result->id = $wpdb->insert_id;
echo json_encode($result);
?>